<script setup>
const { goods } = defineProps(['goods'])
</script>
<template>
	<router-link :to="`/detail/${ goods.id }`" class="goods-item">
		<img v-img-lazy="goods.picture" alt="">
		<h4 class="name">{{ goods.name }}</h4>
		<p class="desc">{{ goods.desc }}</p>
		<span class="price">￥{{ goods.price }}</span>
	</router-link>
</template>

<style scoped lang="scss">
.goods-item {
	margin: 10px 20px;
	width: 200px;
	padding: 20px 0;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: space-around;
	transition: all .5s;
	text-align: center;

	&:hover {
		transform: translate3d(0, -3px, 0);
		box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
	}

	img {
		width: 160px;
		height: 160px;
		margin-bottom: 10px;
	}

	.name {
		width: 160px;
		font-weight: normal;
		white-space: nowrap;
		overflow: hidden;
		text-overflow: ellipsis;
		margin-bottom: 10px;
		font-size: 16px;
	}

	.desc {
		width: 160px;
		font-size: 12px;
		color: #999;
		white-space: nowrap;
		overflow: hidden;
		text-overflow: ellipsis;
		margin-bottom: 10px;
	}

	.price {
		color: $priceColor;
	}
}
</style>